mui.init();
var demo = new Vue({
	el: '#main',
	data: {
		lists: []
	},
	methods: {
		todo: todo
	},
	ready: function() {
		var handUrl = getUrl("64getlist");
		var headerJson = getHeader();
		var datastart = "account=" + readData(localStorage.phone) + "&guideId=" + readData(localStorage.guideId) + "&status=wait";
		this.$http({
			url:handUrl,
			headers:headerJson,
			method:'POST',
			data:datastart
		}).then(function(respons) {
			if (respons.data.code == "0") {
				var serviceList = data.obj.list;
				for (var i = 0; i < serviceList.length; i++) {
					if (serviceList[i].serviceId == "1") {
						serviceList[i].title = "上门试衣";
					} else {
						serviceList[i].title = "定制改衣";
					}
				}
				this.$set("lists",serviceList)
			} else {
				mui.alert('网络连接异常,请稍后重试' + data.code, '提示', function(ret, err) {});
			}
		}, function(respons) {
			console.log('handling网络连接异常')
		});
	}
});

function todo(sid){
	var tourl = getUrl("63service");
	var headerser = getHeader();
	demo.$http({
		url:tourl,
		method:'POST',
		headers:headerser,
		data: 'type=2&id=' + sid
	}).then(function(respons){
		if (respons.data.code == "0") {
				mui.toast('已成功');
				setTimeout(function() {
					plus.webview.currentWebview().opener().close();
				}, 200)
			} else {
				mui.alert('网络连接异常,请稍后重试' + data.code, '提示', function(ret, err) {});
			}
	},function(respons){
		console.log('完成服务网络连接异常')
	})
}
